08. Quiz: MFCC

Mel Frequency Cepstral Coefficients (MFCC)

MFCC feature extraction is complicated to explain, but easy to implement with available libraries.

In this short quiz, you'll write a function that converts a .wav file to MFCC features. You'll need a way to extract the signal from the wave file and then a method
to convert the signal to MFCC. Here are the resources you need to write your function:

When you succeed in returning the correct file, you will "see" the MFCC spectrum in the output similar to the following:

Start Quiz:

from python_speech_features import mfcc
import scipy.io.wavfile as wav


def wav_to_mfcc(wav_filename, num_cepstrum):
    """ extract MFCC features from a wav file

    :param wav_filename: filename with .wav format
    :param num_cepstrum: number of cepstrum to return
    :return: MFCC features for wav file
    """

    # TODO implement
    raise NotImplementedError


from python_speech_features import mfcc
import scipy.io.wavfile as wav


def wav_to_mfcc(wav_filename, num_cepstrum):
    """ extract MFCC features from a wav file
    
    :param wav_filename: filename with .wav format
    :param num_cepstrum: number of cepstrum to return
    :return: MFCC features for wav file
    """
    (rate, sig) = wav.read(wav_filename)
    mfcc_features = mfcc(sig, rate, numcep=num_cepstrum)
    return mfcc_features